

// an array--collection of values, all of which are of the same type
var aArray = new Array( 5 );

aArray[ 0 ] = 0;	// Argentina
aArray[ 1 ] = 0;	// Brazil
aArray[ 2 ] = 0;	// Chile
aArray[ 3 ] = 0;	// Peru
aArray[ 4 ] = 0;	// Venezuela



function showArgentina()
{
	aArray[ 0 ] = aArray[ 0 ] + 1;
	
	
	document.getElementById( "picture1" ).src = "images/Argentina1.jpg";
	document.getElementById( "picture1" ).alt = "This is a map of Argentina.";	
	document.getElementById( "picture1" ).title = "This is a map of Argentina.";
	
	document.getElementById( "picture2" ).src = "images/Argentina2.jpg";
	document.getElementById( "picture2" ).alt = "This is a picture of Argentina's flag";	
	document.getElementById( "picture2" ).title = "This is a picture of Argentina's flag.";
	
	document.getElementById( "caption" ).innerHTML = "Argentina has long history of political instability";	
}

function showBrazil()
{
	aArray[ 1 ] = aArray[ 1 ] + 1;
	
	document.getElementById( "picture1" ).src = "images/Brazil1.jpg";
	document.getElementById( "picture1" ).alt = "This is a map of Brazil.";	
	document.getElementById( "picture1" ).title = "This is a map of Brazil.";
	
	document.getElementById( "picture2" ).src = "images/Brazil2.jpg";
	document.getElementById( "picture2" ).alt = "This is a picture of Brazil's flag";	
	document.getElementById( "picture2" ).title = "This is a picture of Brazil's flag.";
	
	document.getElementById( "caption" ).innerHTML = "Brazil is the largest country in South America";	
}


function showChile()
{
	aArray[ 2 ] = aArray[ 2 ] + 1;
	
	document.getElementById( "picture1" ).src = "images/Chile1.jpg";
	document.getElementById( "picture1" ).alt = "This is a map of Chile.";	
	document.getElementById( "picture1" ).title = "This is a map of Chile.";

	document.getElementById( "picture2" ).src = "images/Chile2.jpg";
	document.getElementById( "picture2" ).alt = "This is a picture of Chile's flag";	
	document.getElementById( "picture2" ).title = "This is a picture of Chile's flag.";

	document.getElementById( "caption" ).innerHTML = "Chile is narrow and long, no wider than 150 miles at it's widest point'";
}

function showPeru()
{
	aArray[ 3 ] = aArray[ 3 ] + 1;
	
	document.getElementById( "picture1" ).src = "images/Peru1.jpg";
	document.getElementById( "picture1" ).alt = "This is a map of Peru.";	
	document.getElementById( "picture1" ).title = "This is a map of Peru.";
	
	document.getElementById( "picture2" ).src = "images/Peru2.jpg";
	document.getElementById( "picture2" ).alt = "This is a picture of Peru's flag";	
	document.getElementById( "picture2" ).title = "This is a picture of Peru's flag.";

	document.getElementById( "caption" ).innerHTML = "Peru is best known for the Incan ruins at Machu Picchu";
}

function showVenezuela()
{
	aArray[ 4 ] = aArray[ 4 ] + 1;
	
	document.getElementById( "picture1" ).src = "images/Venezuela1.jpg";
	document.getElementById( "picture1" ).alt = "This is a map of Venezuela.";	
	document.getElementById( "picture1" ).title = "This is a map of Venezuela.";

	document.getElementById( "picture2" ).src = "images/Venezuela2.jpg";
	document.getElementById( "picture2" ).alt = "This is a picture of Venezuela's flag";	
	document.getElementById( "picture2" ).title = "This is a picture of Venezuela's flag.";

	document.getElementById( "caption" ).innerHTML = "Venezuela is a country rich in oil";
}


function isComplete()
{
	// comparing two values == equals, >= greater than or equal, <= less than or equal to
	// > greater than, < less than, != not equals
	
	if( aArray[ 0 ] >= 1 && aArray[ 2 ] >= 1 && aArray[ 3 ] >= 1 && aArray[ 4 ] >= 1 )
	{
				window.location = "secondpage.html";
	}
	else
	{
		alert( "You did NOT complete the course!" );
	}
}


